﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using strange.extensions.command.impl;
using strange.extensions.dispatcher.eventdispatcher.api;
using strange.extensions.context.api;

public class FirstCommand : Command {
    [Inject(ContextKeys.CONTEXT_DISPATCHER)]//获得一个全局的dispatcher
    public IEventDispatcher dispatcher { get; set; }

    //当该命令被绑定的时候运行就会执行Execute
    public override void Execute()
    {
        Debug.Log("开始运行命令");
        dispatcher.Dispatch(Events.REQUEST_WEB_SCORE);//派发事件 就会触发绑定的方法
        //播放背景音乐
        SoundManager._Instance.PlayBGMusicByName("background");
        SoundManager._Instance.Volume = 0.5f;
    }
}
